<template>
  <el-row>
    <el-col :span="24">
      <el-form label-width="90px">
        <el-form-item label="拆单类型">
          <Radio v-model="routerType"
                 :options="divideOptions" />
        </el-form-item>
      </el-form>
    </el-col>
    <el-col :span="24">
      <div class="footer">
        <el-button type="default"
                   @click="handleCancel">取消</el-button>
        <el-button type="primary"
                   :disabled="disabled"
                   @click="handleSubmit">确定</el-button>
      </div>
    </el-col>
  </el-row>
</template>

<script>
import Radio from "@/components/advance/Radio";
import { divideOptions } from "@/libs/constant.js";
const ROUTERS = {
  1: "lineSplitting",
  2: "numSplitting",
}

export default {
  name: "DivideRouters",
  props: {
    waybillId: Number,
  },
  components: {
    Radio
  },
  data () {
    return {
      routerType: 1,
      disabled: false,
      divideOptions
    }
  },
  methods: {
    handleSubmit () {
      this.$emit("cancel");
      this.$nextTick(() => {
        this.$router.push({
          name: ROUTERS[this.routerType],
          query: { waybillId: this.waybillId },
        });
      })

    },
    handleCancel () {
      this.$emit("cancel");
    }
  }
}
</script>